package com.example.multiple.service;

import com.example.multiple.config.DatabaseContextHolder;
import com.example.multiple.config.DatabaseType;
import com.example.multiple.mapper.SysUserMapper;
import com.example.multiple.model.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author yanggld
 * @Date 2019/6/19-11:30
 * @Description
 */
@Service
public class SysUserService {

	@Autowired
	private SysUserMapper sysUserMapper;

	public List<SysUser> list(String env){
//		DatabaseType databaseType = DatabaseType.valueOf(env);
//		DatabaseContextHolder.setDatabaseType(databaseType);
		List<SysUser> list = sysUserMapper.list();
		return list;
	}

	public SysUser selectById(String env,String id){
		DatabaseContextHolder.setDatabaseType(env);
		SysUser sysUser = sysUserMapper.selectById(id);
		return sysUser;
	}
}
